package cn.itcast.order;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@MapperScan("cn.itcast.order.mapper")
@SpringBootApplication
@EnableFeignClients(basePackages = "cn.itcast.feign.clients") // 开启Feign支持
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

}

///**
// * feign日志配置bean注入方式
// */
//
////启动类加注解
//@EnableFeignClients(defaultConfiguration = DefaultFeignConfiguration .class)// 全局服务配置
//@FeignClient(value = "userservice", configuration = DefaultFeignConfiguration .class)// 局部服务配置
//
////声明bean
//class DefaultFeignConfiguration  {
//    @Bean
//    public Logger.Level feignLogLevel(){
//        return Logger.Level.BASIC; // 日志级别为BASIC
//    }
//}
